package com.kluniv.tank;

import java.awt.Graphics;

/**
 * @author 111
 *
 */
public class Explode {
	protected static final int WIDTH = ResourceMgr.explodes[0].getWidth();
	protected static final int HEIGHT = ResourceMgr.explodes[0].getHeight();

	private int x;
	private int y;

	private TankFrame tf = null;
	private boolean living = true;
	private int step = 0;

	public Explode(int x, int y, TankFrame tf) {
		this.x = x;
		this.y = y;
		this.tf = tf;
		
		new Thread(()->new Audio("audio/explode.wav").play()).start();
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public void paint(Graphics g) {
		g.drawImage(ResourceMgr.explodes[step++], x, y, null);

		if (step >= ResourceMgr.explodes.length)
			tf.explodes.remove(this);
	}
}
